import { request } from '@/utils/request.js'

/**
 * 转运单 API JS
 */

export default {

  /**
   * 获取转运单分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'warehouse/delivery/index',
      method: 'get',
      params
    })
  },

  /**
   * 添加转运单
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'warehouse/delivery/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新转运单数据
   * @returns
   */
  update (data = {}) {
    return request({
      url: 'warehouse/delivery/update/' + data.id,
      method: 'put',
      data
    })
  },

  /**
   * 读取转运单
   * @returns
   */
  read (id,data={}) {
    return request({
      url: 'warehouse/delivery/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 将转运单删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'warehouse/delivery/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 从回收站获取转运单数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'warehouse/delivery/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复转运单数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'warehouse/delivery/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除转运单
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'warehouse/delivery/realDelete',
      method: 'delete',
      data
    })
  },

  /**
   * 更改转运单数据
   * @returns
   */
  changeStatus (data = {}) {
    return request({
      url: 'warehouse/delivery/changeStatus',
      method: 'put',
      data
    })
  },
  addParcel(data = {}) {
    return request({
        url: 'warehouse/delivery/addParcel',
        method: 'post',
        data
    })
},

delParcel(data = {}) {
    return request({
        url: 'warehouse/delivery/delParcel',
        method: 'post',
        data
    })
},
//出货
out(data = {}) {
    return request({
        url: 'warehouse/delivery/changeDeliveryStatus/out',
        method: 'post',
        data
    })
},
//退仓
back(data = {}) {
    return request({
        url: 'warehouse/delivery/changeDeliveryStatus/back',
        method: 'post',
        data
    })
},
//接收
receive(data = {}) {
    return request({
        url: 'warehouse/delivery/changeDeliveryStatus/receive',
        method: 'post',
        data
    })
},
//合并
merge(data = {}) {
    return request({
        url: 'warehouse/delivery/merge',
        method: 'post',
        data
    })
},

  /**
   * 审计
   * @returns
   */
  auditPass (data) {
    return request({
      url: 'warehouse/delivery/audit/pass',
      method: 'post',
      data
    })
  },
  /**
   * 反审计
   * @returns
   */
  auditRefuse (data) {
    return request({
      url: 'warehouse/delivery/audit/refuse',
      method: 'post',
      data
    })
  },

  /**
   * 添加货箱/运单
  * */
  addParcelById(data = {}) {
    return request({
      url: 'warehouse/delivery/addParcelById',
      method: 'post',
      data
    })
  },
    //装箱
    PutParcel (data={}) {
      return request({
        url: 'warehouse/delivery/PutParcel',
        method: 'post',
        data
      })
    },
    //出箱
    OutParcel (data={}) {
      return request({
        url: 'warehouse/delivery/OutParcel',
        method: 'post',
        data
      })
    },
    //封箱
    CloseParcel (data={}) {
      return request({
        url: 'warehouse/delivery/CloseParcel',
        method: 'post',
        data
      })
    },
  //完成配货
  closeOrderPass (data={}) {
    return request({
      url: 'warehouse/delivery/closeOrder/pass',
      method: 'post',
      data
    })
  },
}